package com.liit.controller.func;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.liit.controller.index.BaseController;
import com.liit.entity.CityFormMap;
import com.liit.entity.ProvinceFormMap;
import com.liit.mapper.RegionMapper;

/**
 * @author dingweibo
 * @Title: WeixinUserController.java
 * @Description: TODO(用一句话描述该文件做什么)
 * @date 2016年1月26日
 */
@Controller
@RequestMapping("/region/")
public class RegionController extends BaseController {

	@Inject
	private RegionMapper regionMapper;

	@RequestMapping("loadProvince")
	@ResponseBody
	public List<ProvinceFormMap> loadProvince() throws Exception {
		return regionMapper.findByWhere(getFormMap(ProvinceFormMap.class));
	}

	@RequestMapping("loadCityByProvinceId")
	@ResponseBody
	public List<CityFormMap> loadCityByProvinceId(String provinceId) throws Exception {
		return regionMapper.findByAttribute("provinceId", provinceId, CityFormMap.class);
	}
}
